home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1993-02-25 | 2.3 KB | 85 lines |
- '----------------------------------------------------------------------------
- ' Squash_a_Bob.AMOS
- '
- ' By Francois Lionet
- '----------------------------------------------------------------------------
- F$=Fsel$("*.Abk","","Enter sprite bank to load")
- If F$="" : Edit : End If
- Load F$
- If Length(1)=0 : Edit : End If
- '
- MXSPR=Length(1)
- Print "Number of bobs: ";MXSPR
- Repeat
- Input "Start at which bob? ";STSPR
- Until STSPR>=1 and STSPR<=MXSPR
- Repeat
- Input "End at which bob? ";ENSPR
- Until ENSPR>=STSPR and ENSPR<=MXSPR
- Repeat
- Input "Number of colours? ";NCOL
- NPLANE=1 : C=2
- While C<>NCOL and NPLANE<7
- Inc NPLANE : C=C*2
- Wend
- Until NPLANE<7
- Repeat
- Input "Enter bank number to create: ";BNUMB
- Until BNUMB>1 and BNUMB<16
- Repeat
- BWORK=Rnd(8)+6
- Until BWORK<>BNUMB
- '
- Screen Open 0,320,200,NCOL,0
- Flash Off : Get Sprite Palette
- Paper 0 : Pen 1 : Clw
- BIGX=0 : BIGY=0
- '
- For N=1 To MXSPR
- If N>=STSPR and N<=ENSPR
- Cls 0,0,0 To 320,100
- A=Sprite Base(N)
- SX=Deek(A)*16 : SY=Deek(A+2) : ICOL=Deek(A+4)
- If ICOL<>0
- Paste Bob 0,0,N
- Erase BWORK : Pack 0 To BWORK,0,0,SX,SY
- Add PSIZE,Length(BWORK)
- Add NSIZE,((SX*SY)/8)*NPLANE
- Print At(0,24);"Normal size";NSIZE;" / Packed size";PSIZE;
- If SX>BIGX
- BIGX=SX
- End If
- If SY>BIGY
- BIGY=SY
- End If
- End If
- End If
- Next
- '
- Reserve As Data BNUMB,PSIZE+MXSPR*10+4
- APACK=Start(BNUMB)+MXSPR*10
- Clw : Centre At(,24)+"...Final size:"+Str$(PSIZE+MXSPR*10+4)+" ("+Str$(NSIZE)+" )..."
- Centre At(,23)+"Largest X: "+Str$(BIGX)+" Largest Y: "+Str$(BIGY)
- '
- For N=1 To MXSPR
- If N>=STSPR and N<=ENSPR
- Cls 0,0,0 To 320,100
- A=Sprite Base(N)
- SX=Deek(A)*16 : SY=Deek(A+2) : ICOL=Deek(A+4)
- If ICOL<>0
- Paste Bob 0,0,N
- Erase BWORK : Pack 0 To BWORK,0,0,SX,SY
- AOFF=Start(BNUMB)+(N-1)*10
- Doke AOFF,(APACK-Start(BNUMB))/2
- Loke AOFF+2,Leek(A) : Loke AOFF+6,Leek(A+6)
- Copy Start(BWORK),Start(BWORK)+Length(BWORK) To APACK
- Add APACK,Length(BWORK)
- End If
- End If
- Next
- '
- F$=Fsel$("*.Abk","","Please enter saved bank name...")
- If F$<>""
- Save F$,BNUMB
- End If
- Erase 1 : Erase BNUMB : Erase BWORK